package cn.gson.tj_springboot.controler.limitController;

import cn.gson.tj_springboot.model.service.limitService.PrivilegeService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
//@RequestMapping("/privilege")
public class PrivilegeController {
    @Autowired
    PrivilegeService ps;

    @RequestMapping("/role-list")
    @ResponseBody
    public Map<String,Object> roleList(Integer page, Integer size){
        Page<Object> obj = PageHelper.startPage(page,size);
        List<Map<String,Object>> maps = ps.allRoles();
        Map<String,Object> map = new HashMap<>();
        map.put("total",obj.getTotal());
        map.put("rows",maps);

        return map;
    }
}
